<?php

namespace App\Repositories\Eloquent\Exm;

use Illuminate\Container\Container as App;
use App\Repositories\Eloquent\Repository;

class AuserRepository extends Repository
{

    /**
     * @param App
     */
    public function __construct(App $app)
    {
        parent::__construct($app);
    }

    /**
     * 指定模型名称
     *
     * @return mixed
     */
    function model()
    {
        return 'App\Models\Exm\Auser';
    }

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index($query = '')
    {
        // 获取分页数据
        if (!$query) {
            $result = $this->model
                ->orderBy('order', 'asc');
        } else {
            // 若有查询参数
            $result = $this->model
                ->where('name', 'like', "%$query%");
        }

        return $result;
    }

   
    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store($request)
    {
        $result = $this->create([
            'uid' => $request->title,
            'account' => $request->isbn,
            'bookcase' => $request->bookcase,
            'bookshelf' => $request->bookshelf,
            'bookcategory' => $request->bookcategory,          
        ]);

        return !!$result;
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }

    
}